package com.mooc.fuxi.utils;

import android.content.SharedPreferences;

import com.mooc.fuxi.App;

public class SPUtils {

    private SharedPreferences sharedPreferences;
    private SPUtils(){
        sharedPreferences = App.getInstance().getSharedPreferences("user",0);
    }

    private volatile static SPUtils instance;

    public static SPUtils getInstance() {
        if (instance == null){
            synchronized (SPUtils.class){
                if (instance == null){
                    instance = new SPUtils();
                }
            }
        }
        return instance;
    }

    public void put(String key,boolean value){
        sharedPreferences.edit().putBoolean(key,value).commit();
    }

    public boolean isLogin(String key){
        return sharedPreferences.getBoolean(key,false);
    }

}
